package com.zrrd.wemedia.controller.v1;

import com.zrrd.model.common.dtos.ResponseResult;
import com.zrrd.model.wemedia.dtos.WmNewsDto;
import com.zrrd.model.wemedia.dtos.WmNewsPageReqDto;
import com.zrrd.wemedia.service.WmNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author WanJl
 * @version 1.0
 * @title WmNewsController
 * @description
 * @create 2023/9/21 15:47
 */
@RestController
@RequestMapping("/api/v1/news")
public class WmNewsController {
    @Autowired
    WmNewsService wmNewsService;

    @PostMapping("/list")
    public ResponseResult findAll(@RequestBody WmNewsPageReqDto dto){
        return wmNewsService.findAll(dto);
    }

    @PostMapping("/submit")
    public ResponseResult submitNews(@RequestBody WmNewsDto dto){
        return wmNewsService.submitNews(dto);
    }
    //http://127.0.0.1:8802/wemedia/MEDIA/wemedia/api/v1/news/one/6235
    @GetMapping("/one/{newsId}")
    public ResponseResult toUpdate(@PathVariable("newsId") Integer newsId){
        System.out.println(newsId);
        return null;
    }
}
